const http = require('http')

let options = {
  host:'localhost',
  port:1234,
  path:'/',
  method:'POST'
}

const server = http.createServer((req0, res0)=>{
  let req = http.request(options, (res)=>{
    let arr = []
    res.on('data',(data)=>{
      arr.push(data)
    })
    res.on('end', ()=>{
      let obj = Buffer.concat(arr).toString()
      // console.log('客户端数据接收',obj)
      res0.setHeader('Content-type','text/html;charset=utf-8')
      res0.end(obj)
    })
  })
  
  req.end('世界和平')
})
server.listen(2345,()=>{
  console.log('本地代理服务开始运行')
})
